Dynamic buffer allocation

ABSTRACT

The present disclosure relates to a switch for a network, and specifically the dynamic allocation of buffer memory within the switch. A communication channel is established between the switch and a network device. The switch configures and allocates a portion of memory to a receive socket buffer for the established channel. Upon receipt of a signal from the network device, the switch allocates a second portion of memory to the receive socket buffer.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to Foreign Application No. GB1603034.8,filed on Feb. 22, 2016, the content of which is hereby incorporatedherein by reference in its entirety.

BACKGROUND OF THE INVENTION

Field of the Invention

Embodiments disclosed herein relate to a switch for a computer network,and specifically the dynamic allocation of buffer memory within theswitch in response to different types of data transmission requirementsover the network. Embodiments also relate to a network device configuredto communicate with the switch over the network.

Description of the Related Technology

Computer networks allow networked computing devices to exchange datawith each other along communication channels (data connections)established using either physical cable media, or wireless media. Anetwork socket is the endpoint of such a two-way communication channelon a computer network.

A switch connects network devices together, electrically and logically,by using data packet switching to receive, process and forward data overa computer network to the intended network device(s). Alternative, olderdevices, such as network hubs, connected multiple network devicetogether over a computer network by broadcasting the same data to eachnetwork socket, and each connected network device. In contrast, a switchforwards data only to a specific network device (or specific multiplenetwork devices). Each network device connected to a switch can beidentified using a Media Access Control (MAC) address, a uniqueidentifier allowing the switch to regulate and direct the flow ofnetwork traffic, improving the security and efficiency of the network.

When transferring data over a network, each device (including theswitch) typically allocates a portion of memory to be used as atemporary “holding pen” for data that is being sent or received,enabling each device to manipulate and prepare the data before sendingit on, or saving it. This temporary storage is known as a “buffer”, andit ensures that any sent or received data has somewhere to go, i.e.,into the buffer temporarily, until its ultimate destination becomesdecided and available.

Different computer systems, networks and connection types employdifferent communication protocols to send and receive data. The mostcommon network for data transmission is the Internet, which uses theTransmission Control Protocol (TCP) as the core protocol of the Internetprotocol suite (IP). TCP is a “reliable” protocol which providesacknowledgement of successful delivery of data to the intendedrecipient(s). Using TCP involves both a “send buffer” and a “receivebuffer”, for sending and receiving data respectively, and the size ofeach buffer may be adjusted independently of each other. The send bufferdetermines how much data to be sent can be temporarily held beforereceiving acknowledgement that the data has been received, and thereceive buffer determines how much data, that have been received and notpassed to an upper layer, can be temporarily held before further datacan be received at the socket. Furthermore, the TCP “send window”parameter determines the amount of unacknowledged data that can be “inflight” between the sending and receiving sockets of a communicationchannel, at any given time.

To avoid network traffic congestion, TCP employs a congestion-avoidancealgorithm, and each of the parameters (send buffer, receive buffer, sendwindow) can be “tuned” independently to improve traffic throughput. Formaximum throughput in a communication channel, the smaller of either thesend buffer or the receive buffer is adjusted to be sufficiently largeso that any data transfer can saturate the underlying communicationchannel. A fundamental concept in a window-controlled transport protocol(such as TCP) is the “Bandwidth Delay Product” (BDP), which representsthe maximum possible amount of data held on the network circuit at anygiven time, i.e., data that has been sent but not yet acknowledged. Ifthe bandwidth (bits per second) of the communication channel is C, andthe round-trip time (in seconds) is T, the maximum possible throughput(in bits) is achieved when the send window is equal to the BDP, whereBDP=C×T. In order to saturate the communication channel, the smaller ofeither the send or the receive buffer should be equally as large as theBDP. If the size of the smaller socket buffer is less than the receivewindow, the communication channel will underutilize the path. If thesmaller of the send and receive socket buffers is larger than thereceive window, the communication channel will overload the path, anddepending on the amount of buffering, the transfer may cause bufferoverflows, receive window reductions, and throughput drops.

Known methods of TCP tuning are described in “Socket Buffer Auto-Sizingfor High-Performance Data Transfers” by Ravi S. Prasad et al, whichdiscloses a congestion control method (“SOcket Buffer AutoSizing”—SOBAS) incorporating an application-layer mechanism thatautomatically determines the send and receive buffer sizes in order tosaturate the available bandwidth in a communication channel while a datatransfer is in progress. This is achieved in non-congested paths bylimiting the receive buffer size, and therefore by association themaximum possible send window (since the size of the send window islimited by the receive buffer size), so that any data transfer saturatesthe channel but does not cause a buffer overflow. In congested paths, onthe other hand, SOBAS increases the buffer size to maximum, so that thetransfer is congestion limited.

The prior art also discloses methods of dynamic buffer allocation in acommunication channel. Embodiments disclosed herein provide a novel,pre-emptive solution allowing data to be transferred over potentiallyredundant existing communication channels, without initiating a newchannel, and thereby reducing overheads.

SUMMARY OF THE INVENTION

According to a first aspect of the present disclosure, there is provideda switch for a network, the switch comprising a processor and memory,whereby the processor is configured to establish a first communicationchannel between the switch and one of at least two network devices,configure, at the switch, a first receive buffer for the firstestablished channel, allocate a first portion of memory to the firstreceive buffer, and (in response to receiving a first signal from theone of said at least two network devices over the first communicationchannel established between the switch and said one of said at least twonetwork devices) allocate a second portion of memory to the firstreceive buffer. This device avoids the need to setup or drop a newconnection for the transmission of large data to the switch, and therebyimproves efficiency.

Preferably, the processor is further configured to send a first signalto the one of at least two network devices over the first communicationchannel established between the one of said at least two network devicesand the switch, confirming allocation of the second portion of memory tothe first receive buffer. Preferably still, the processor is furtherconfigured to delay sending the first signal until sufficient secondportions of memory are available to allocate the second portion ofmemory to the first receive buffer. This ensures that the data transferdoes not begin until a sufficient memory is allocated to the receivebuffer.

The processor may be further configured to send a second signal to theone of at least two network devices (over the first communicationchannel established between one of said at least two network devices andthe switch) and de-allocate the second portion of memory from the firstreceive buffer. The shared memory is returned to the “pool”, and can beallocated to another receive socket buffer as and when it is needed.

In one arrangement, the second portion of memory is greater than thefirst portion of memory. A small amount of memory is allocated to eachreceive socket buffer initially. This memory is sufficient to handle thesmall (“fast”) data transfers. When a larger amount of data is to besent to the switch, the switch allocates memory from a “pool” of largebuffers.

Preferably, the size of the first memory portion and second memoryportion are predetermined. This significantly reduces the overhead andsubstantially improves performance for objects that need frequentallocation and de-allocation.

The first portion of memory may be 4 kilobytes and the second portion ofmemory is 128 kilobytes. The lower limit allows for small (“fast”) datatransfer between the switch (which represents the majority of all datatransferred) to be handled by any channel at any time. The larger limitis suitable for handling the majority of anticipated large datatransfers.

In one arrangement, the processor is further configured to receive datafrom the one of said at least two network devices (over the firstcommunication channel established between the switch and said one ofsaid at least two network devices) and the received data may comprise anamount of data that is smaller in size than the first portion of memory,interposed with an amount of data that is larger in size than the firstportion of memory. This ensures the small (“fast”) data is not held upby any large (“slow”) data being sent at the same time. The small datatherefore maintains a kind of priority.

Preferably, the processor is further configured to automaticallyallocate said first portion of memory to the first receive buffer whenthe first communication channel is established. Therefore thecommunication channel always has enough buffer memory to handle the mostcommon, small (“fast”) data requests.

The processor may be further configured to dynamically allocate thesecond portion of memory to the first receive buffer from availablesecond portions of memory that can be allocated to one of either of theleast two network devices. Therefore the “pool” of large memory bufferscan be used by any socket buffer as and when they need them. The overallmemory requirements are reduced, and the buffers can be dynamicallyallocated to where they are needed.

In one arrangement, the processor is further configured to establish asecond communication channel between the switch and another of said atleast two network devices and configure, at the switch, a second receivebuffer for the second established channel. The processor then allocatesa first portion of memory to the second receive buffer, and in responseto receiving a signal from the another one of said at least two networkdevices (over the second communication channel established between theswitch and said another one of said at least two network devices),allocates a second portion of memory to the second receive buffer. Theswitch is therefore able to accommodate large data transfers to multiplesockets in the switch.

Preferably, the processor is further configured to allocate and/orde-allocate any of the first or second portions of memory to the firstreceive buffer, and the first or second portions of memory to the secondreceive buffer, asynchronously of one another. Therefore the switch isable to handle, and coordinate, multiple large data transfers tomultiple sockets, at different times.

According to a second aspect of the present disclosure, there isprovided a network device comprising a software agent configured toestablish a communication channel between the network device and aswitch, and send a signal to the switch if an amount of data to betransferred from the network device to the switch over the establishedcommunication channel is greater than a first predetermined amount.Working in tandem with the switch of the invention, the network deviceprovides a signal before sending any pre-agreed “large” data, so thatthe switch can allocate an increased memory buffer to the receive socketas described above. In one embodiment the software agent comprises a setof instructions to be executed by the network device to perform thedescribed functionality.

Preferably, the agent is further configured to delay transferring datalarger in size than the first predetermined amount until the agentreceives a signal from the switch confirming the switch is configured toreceive data larger in size than the first predetermined amount.Therefore, not only does the network device provide a signal warning theswitch of incoming large data, but also delays sending the large datauntil the switch confirms it is ready to receive it.

The agent may be further configured to fragment the data that is largerthan the first predetermined amount into blocks, equal in size to asecond predetermined amount, to be transferred to the switch over theestablished communication channel. The network device breaks up thelarge response data into chunks that can be handled by the switch, i.e.data packets the size of the (increased) receive buffer. Therefore thenetwork device is able to transmit, and the switch is able to receive,response data of any size.

In one arrangement, the agent is further configured to interposetransmission of an amount of data that is smaller in size than the firstpredetermined amount with an amount of data that is larger in size thanthe first predetermined amount. Therefore, the small and large dataresponses can be sent at the same time, and the small data is notdelayed because of the large data transfer.

According to a third aspect of the present disclosure, there is provideda method of dynamically allocating memory to a receive buffer. Themethod comprises establishing a first communication channel between aswitch and one of at least two network devices, configuring, at theswitch, a first receive buffer for the first established channel,allocating a first portion of memory to the first receive buffer,receiving a first signal from the one of said at least two networkdevices over the first communication channel (established between theswitch and said one of said at least two network devices), andallocating a second portion of memory to the first receive buffer. Thismethod avoids the need to setup or drop a new connection for thetransmission of large data to the switch, and thereby improvesefficiency.

According to further aspects there is provided a computer programcomprising a set of instructions, which, when executed by a processor ofa switch, causes the switch to execute the method steps set out above.

Further features and advantages will become apparent from the followingdescription of preferred examples, which is made with reference to theaccompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a schematic view of a network device and a server connectedover a network to a switch.

FIG. 2 shows a schematic view of multiple network devices and a server,connected over a network to a switch.

FIGS. 3a to 3c show an expanded view of the switch as seen in FIG. 2during the initialization of the switch.

FIG. 4 is a data transmission diagram between the switch and the networkdevice as seen in FIGS. 3a to 3 c.

FIG. 5 shows a further expanded view of the switch as seen in FIG. 2.

FIG. 6 is a data transmission diagram between the switch and the networkdevice as seen in FIG. 5.

FIG. 7 shows a further expanded view of the switch as seen in FIG. 2.

FIG. 8 is a data transmission diagram between a switch and a networkdevice as seen in FIG. 7.

FIG. 9 shows a method of dynamic buffer allocation according to anexample.

FIG. 10 shows instructions stored in a non-transient machine-readablestorage medium to be executed by a processor.

DETAILED DESCRIPTION OF CERTAIN INVENTIVE EMBODIMENTS

Initiation of a Switch

FIG. 1 shows a server 10 connected over a network communication channel20 to a switch 100. In some examples, the server 10 is a webserver. Theswitch 100 is also connected to a network device 150 via a communicationchannel 140. There is also shown a user terminal 1 connected to theserver 10 by a communication channel 5. An end user may command theserver 10 using the terminal 1, to provide instructions to the networkdevice 150, via the switch 100. Furthermore, response data from thenetworked device 150 may be received at the terminal 1, via the server10 and the switch 100. In other examples, the server 10 may be accessedand operated by means other than a user terminal 1, such as by another,remote, server over a network connection. The communication ofinstruction and response data between the network device 150 and theswitch 100 is independent of any information transfer between the switch100 and the server 10.

FIG. 2 shows the switch 100 shown in FIG. 1, connected to multiplenetwork devices 151-155 over multiple communication channels 141-145.Instructions are sent to, and response data received from, each of thenetwork devices 151-155 over the network from the terminal 1, via theserver 10 and the switch 100. Each network device 151-155 incorporates asoftware agent (not shown) which can carry out queries or executionrequests at each respective network device 151-155 in response toinstructions received over the network from the terminal 1, via theserver 10 and the switch 100. In a preferred example, each networkdevice 151-155 incorporates only a single software agent. The softwareagents may also send response data back over the network on theirrespective communication channels 141-145 to the terminal 1, via theserver 10 and the switch 100.

FIGS. 3a to 3c show the switch 100 in greater detail. As seen in FIG. 3a, the switch 100 comprises a processor 110 and memory 170. When theswitch 100 is initiated, the processor 110 creates a number of workerprocesses. The worker processes pre-allocate a socket (communicationchannel endpoint) in the switch 100 to each of at least one networkdevice 151-155 as the network device(s) connect to the network, andestablish a communication channel 141-145 between each network device151-155 and the switch 100. In a preferred example, the worker processesestablish only a single connection channel 141-145 for each networkdevice 151-155, and therefore only a single socket is allocated to eachnetwork device 151-155. In a further example, the switch creates up toonly 64 worker processes, depending on the number of network devices,software agents, and communication channels requested by any givensoftware agent. The number of worker processes may be limited, forexample to 64, so as to avoid the switch 100 overwhelming the server 10with data in response to any instructions received from the userterminal 1.

If more throughput can be handled by the server 10, then it is possibleto incorporate more than one switch 100 on a single server 10. Inanother example, each worker process pre-allocates up to a maximum of1024 sockets in the switch 100 for connection to the network. In thisexample, the upper limit of 1024 sockets per worker process is a resultof the default file descriptor bit value (set using the FD_SET command)being limited, and some operating systems require extensive recoding inorder to exceed this upper boundary. Therefore, in the abovementionedexamples, the maximum number of sockets that can be pre-allocated islimited to under 65,536 (64×1024), wherein a small number of thesesockets are reserved for internal communication purposes.

In a preferred example, and as seen in FIG. 3b , during initializationthe switch memory 170 is divided into pre-designated (pre-assigned,pre-labelled or pre-allocated) first portions of buffer memory 130 andsecond portions 160 of buffer memory. These first portions 130 andsecond portions 160 of buffer memories may be allocated to differentsockets within the switch 100 by the processor 110, depending upon theindividual socket needs.

As shown in FIG. 3c , the processor 110 establishes a receive buffer121-125 for each socket. In one example, each receive socket buffer isused to store the “static data” received from each respective softwareagent, such as the software and the hardware configuration of eachrespective network device 151-155. Each receive socket buffer 121-125 isalso allocated a first portion of memory 131-135, from thepre-designated first memory portions 130, for transfer of data acrossthe socket. This first portion of memory 131-135 is allocated on asemi-permanent basis, and the first portion of memory 131-135 remainsallocated to the socket as long as the socket persists. This initial(semi-permanent) allocation of a first portion of memory 131-135 to eachsocket buffer ensures that each communication channel 141-145 hassufficient memory to work, and therefore eliminates any chance of amemory request being refused by the system, or causing virtual memorythrashing. In one example, the first portion of memory 131-135 allocatedto each receive socket buffer 121-125 is relatively small, and in afurther example is only 4 kilobytes in size.

Whilst a network device 151-155 is connected via a communication channel141-145 to the switch 100, instructions may be sent to a chosen networkdevice 151-155 from a server 10 (as directed by a user at a terminal 1)to be carried out on the network device by the software agent. Responsedata is sent back to the server 10 (and onto the user terminal 1) overthe network via the switch 100. For example, an instruction might be torelay usage data of a network device 151-155 back to the server 10 (andonto the user terminal 1), via the switch 100. When the response datafrom a software agent is smaller than the first portion 131-135 ofmemory allocated to the corresponding receive socket buffers 121-125 atthe switch 100 (i.e. in the example above, under 4 kilobytes in size),it is considered as “small” response data and does not need anyadditional memory allocated to the receive socket buffer 121-125 inorder to be transferred. When the response data from a software agent islarger than the first portion 131-135 of memory allocated to thecorresponding receive socket buffers 121-125 (i.e. in the example above,over 4 kilobytes in size) at the switch 100, it is considered as “large”response data and requires additional memory to be allocated to thecorresponding receive socket buffer 121-125 in order to be transferred.

Persistent Connection

In preferred embodiments the communication channel(s) 141-145 betweenthe switch 100 and a network device 151-155 is maintained as a“persistent connection”, i.e. a single connection to send and receivemultiple instructions and responses. After the successful completion ofa round of instructions and response data, the communication channel141-145 is not dropped, but is instead kept open. When the switch 100sends another set of instructions, and a network device 151-155responds, the same communication channel 141-145 is used as before. Thecommunication channel 141-145 will remain open until either the switch100 or the network device 151-155 drops the communication channel. Thishelps reduce network overheads accrued from dropping and openingcommunication channels for each instance of data transfer.

Small/Fast Data

Typically, small (or “fast”) data makes up the majority of the datatransfer between the switch 100 and any network device 151-155, andcomprises short instructions to, and small replies from, the networkdevice 151-155. In a first example, the first portion of memory 131-135allocated to each receive socket buffer 121-125 is used by the switch100 for receiving of small (or “fast”) data responses from the networkdevices 151-155. Therefore every small (or ‘fast’) data transfer willautomatically have adequate receive buffer memory available because thefirst portion of memory 131-135 is allocated to each receive socketbuffer 121-125 upon initialization of the switch 100. This first portionof memory 131-135 remains allocated to each receive socket buffer121-125 as long as the corresponding socket persists. It is possiblethat the connection 141-145 may be dropped, but the socket, andtherefore the receive socket buffer 121-125 and first portion of memory131-134 allocation, is maintained.

FIG. 4 shows an example of data transfer between the switch 100 and oneof the multiple network devices 151-155. Firstly, a communicationchannel 141 is established between the switch 100 and the network device151 when the network device 151 connects to the network (step 410). Inone example, upon connection to the network, the software agent on thenetwork device 151 may forward “static data” concerning the networkdevice 151 to the switch 100, to be stored in the corresponding receivesocket buffer 121 (step 415) in the switch 100.

After the initial network set up is complete, queries or executionrequests may be sent from a server 10 (as directed by a terminal 1) overthe network, via the switch 100, for the software agent on the networkdevice 151 to carry out (step 420). The software agent carries out theinstructions on the network device 151, and sends the response data backto the server 10 (and onto the terminal 1) over the network via theswitch 100 (step 430).

Any data exchanged between two sockets on the network is loaded into ina send buffer on the sending side before being sent, and loaded into areceive buffer on the receiving side as it is received. When the inboundresponse data from the network device 151 to the switch 100 (step 430)is small enough to be accommodated by the receive socket buffer 121 inthe switch 100 (i.e. is smaller in size than the first portion of memory131 allocated to the receive socket buffer 121 of the switch 100), theback and forth request (step 420) and response (step 430) data exchangesteps will continue in this manner, with the switch 100 in the presentconfiguration, as long as the communication channel 141 is maintained.

Large/Slow Data

In the event that data to be sent from a network device 151 is larger insize than the initial corresponding receive socket buffer 121 (i.e.larger in size than the first amount of memory 131 allocated to the saidreceive socket buffer), then the processor 110 of the switch 100allocates a second portion of memory 161, from the available secondportions of memory 160, to the corresponding receive socket buffer 121.

FIGS. 5 and 6 show the configuration of the switch 100 and data exchangebetween a network device 151 and the switch 100, whereby an instructionresults in response data larger in size than the first portion of memory131 allocated to the receive socket buffer 121 being sent to the switch100 from the network device 151.

A communication channel 141 is established between the switch 100 andthe network device 151 in the same manner as before (step 610) as thenetwork work device 151 connects to the network. In one example, uponconnection to the network, the software agent on the network device 151may forward “static data” concerning the network device 151 to theswitch 100, to be stored in the receive socket buffer 121 (step 615).These initial steps (steps 610, 615) are only carried out as eachnetwork device 151-155 connects to the network. If the communicationchannel 141 has already been established, then the process of sending“large” response data from the network device 151 to the switch 100 maybegin immediately following the steps shown in FIG. 4 above (steps 410,415, 420, 430). Once a communication channel 141 has been established,instructions are sent from the server 10 (directed by a user at theterminal 1) over the network, via the switch 100, to network device 151(step 620). The software agent carries out the instructions on thenetwork device 151 and attempts to send the response data back to theswitch 100.

However, in order for the switch 100 to be able to accept any large (or“slow”) response data from the network device 151, the processor 110must first allocate a second portion of memory 161 (from the availablesecond portions 160 of buffer memory) to the receive socket buffer 121at the corresponding socket (in addition to the first portion of memory131 allocated upon initiation of the socket).

The second portion of memory 161 is allocated by the processor 110 tothe receive socket buffer 121 in response to a signal received from thenetwork device 151, and before transmission of the large data responsecommences. More specifically, if an instruction, sent from the server 10over the network via the switch 100 (step 620), results in response datalarger than the first portion of memory 131 allocated to the receivesocket buffer 121 (e.g. larger than 4 kilobytes, the initial receivesocket buffer 121 size), then the network device 151 sends a signal tothe switch 100 (step 630), requesting that the switch 100 prepare toreceive larger data. This signal is known as the “Big Ready” message(BR1), and indicates the network device 151 is ready to send largeresponse data to the switch 100.

Upon receipt of the “Big Ready” message BR1, the processor 110 of theswitch 100 attempts to allocate a second portion of memory 161, from theavailable second portions of memory 160, to the receive socket buffer121, in addition to the first portion of memory 131 (step 640). In oneexample, the second portion of memory 161 allocated to the receivesocket buffer 121 is larger than the first portion of memory 131allocated to the receive socket buffer 121. In a further example, thesecond portion of memory 161 allocated to the receive socket buffer 121is 128 kilobytes in size.

Preferably, if allocation of the second portion of memory 161 issuccessful, the switch 100 sends a go-ahead signal OK1 back to thenetwork device 151 (step 650). The software agent may then begin sendingthe large response data DATA1 over the communication channel 141 back tothe server 10, via the switch 100 (step 660).

The software agent typically breaks up the large response data into“blocks” to be transferred over the communication channel 141 andreceived by the switch 100. In one example, the large response data isfragmented into blocks of the same size as the second portion of memory161, e.g. 128 kilobytes. In other examples, the software agent may beconfigured to fragment any large response data into block of othersizes. As each block is successfully delivered to the switch 100, afurther go-ahead signal OK1 is sent by the switch 100 back to thenetwork device 151 (step 650). In a preferred example, the switch 100analyses the round-trip-time of each block as it is requested and sentby the network device 151. By comparing previously recordedround-trip-times, the switch 100 may estimate the congestion level ofthe network, and delay requesting the next block of large response data(by delaying sending the go-ahead signal OK1) depending upon thecalculated network congestions level (i.e. wait until the networktraffic has reduced). The steps of sending a block of data DATA1 (step660), receiving the block, and signaling the software agent on thenetwork device 151 with a subsequent go-ahead signal OK1 (step 650) maybe repeated until the entire message has been successfully transferred.

Preferably, once the switch 100 has successfully received all of thelarge response data, it sends a “large data complete” signal BF1 (step670) back to the software agent on the network device 151.

In a further example, once the transmission of large data has beensuccessfully completed, the processor 110 may de-allocate the secondportion of memory 161 from the receive socket buffer 121 (step 680),whereupon the de-allocated memory becomes part of the available secondportions of memory 160 once more, ready to be “dynamically” re-allocatedto any of the receive socket buffers 121-125 as and when needed (i.e.for large/slow data transfers).

In one example, if at any time either the switch 100 or the networkdevice 151 should drop the communication channel 141 between them duringtransfer of large response data, any large response data transferredduring the response session will be lost. In a further example, an errormessage “Big Error” is sent to the software agent on the network device151 if the switch 100 is unable to complete the transfer.

By allocating additional memory 161 from the available second portionsof memory 160 to the receive socket buffer 121, the switch 100 cantransfer large/slow data over the already-existing communication channel141, and the need to create a new communication channel to accommodatethe large/slow response data is eliminated. Additional set-up and teardown of communication channels over the network uses software andhardware resources, and so the present method reduces overall networktraffic and system resource consumption.

No Available Memory

In one example, if there are no second portions of memory 160 availablefor allocation to a receive socket buffer 121-125, the transmission oflarge data by the software agent is delayed until sufficient amounts ofsecond portions of memory 160 become available. The switch 100 will notsend the go-ahead signal OK1 to the network device 151 until a secondportion of memory has been successfully allocated to the correspondingreceive socket buffer 121-125.

Interposing Small and Large Response Data

In one example, in the event that the network device 151-155 is in theprocess of sending large response data DATA1 at the same time asinstructions for small (or “fast”) response data arrive, the smallresponse data may be interposed into the large response data stream toensure that there is no delay in the small response data being receivedwhilst waiting for one or more large response data to successfullycomplete. In this way the small response data therefore maintains apriority over the large (“slow”) response data.

Multiple Network Devices

FIGS. 7 and 8 (in conjunction with FIG. 6) show an example whereby theswitch 100 is configured to handle multiple network devices 151, 153attempting to send large response data at the same time.

However, because the network devices 151-155 connected to the switch 100are able to operate entirely independently of each other, it is likelythat each network device 151-155 will connect to the switch 100, receiveinstructions, and provide response data (both small/fast and large/slow)asynchronously, i.e. at different times to each other. These embodimentssimply assume that there is an overlap between the sending of largeresponse data from more than one network device. Preferably therefore,the switch 100 is able to establish multiple communication channels141-145 and allocate the first portions 130 and second portions 160 ofavailable memory between each of the multiple network devices 151-155both asynchronously and simultaneously.

Referring to the presently described example—where the large responsedata is to be transmitted at the same time—it is to be understood thatthis is one example of such overlap. In this example, two networkdevices 151, 153 are connected to a switch 100 over correspondingcommunication channels 141, 143 (steps 610, 810). The processor 110 hasconfigured a receive socket buffer 121, 123 for each socketcorresponding with each communication channel 141, 143, and assigned afirst portion of memory 131, 133 to each receive socket buffer 121, 123.In one example, upon connection to the network, each software agent on anetwork device 151, 153 may forward “static data” concerning thecorresponding network device 151, 153 to the switch 100, to be stored inthe receive socket buffer 121, 123 (steps 615, 815). Whilst furthernetwork devices 152, 154, 155 are shown in FIG. 7, in this example theydo not require any additional buffer memory beyond the first portions ofmemory 132, 134, 135 allocated to their corresponding receive socketbuffers 122, 124, 125.

As described before, instructions may be sent from a server 10 (asdirected by a user at a terminal 1 over communication channel 5) viacommunication channel 20 to the switch 100, requesting data or theexecution of a program on any of the multiple of the network devices151, 153 on the network. If the response data from the network devices151, 153 is smaller in size than the first portion of memory 131, 133allocated to each receive socket buffer 121, 123 in the switch 100, theneach network device 151, 153 will communicate with the switch in themanner described previously in relation to FIG. 4.

However, in the example shown in FIGS. 7 and 8 (in conjunction with FIG.6), the instructions sent to two of the network devices 151, 153 (steps620, 820) have resulted in large response data (i.e. that larger in sizethan the first portion of memory 131, 133 allocated to the correspondingreceive socket buffers 121, 123). Each of the software agents deployedon these network devices 151, 153 sends a “Big Ready” signal BR1, BR3 tothe switch 100 over the corresponding communication channel 141, 143(steps 630, 830). If there is are sufficient second portions of memory160 available, then the processor 110 will allocate a second portion ofmemory 161, 163 to each receive socket buffer 121, 123 as necessary(steps 640, 840). As each of the two receive socket buffers 121, 123 isallocated a second portion of memory 161, 163 from the available secondportions of memory 160, the processor 110 in the switch 100 sends ago-ahead signal OK1, OK3 over each corresponding communication channel141, 143 informing the software agent on each corresponding networkdevice 151, 153 that the switch 100 is ready to receive the largeresponse data on the corresponding communication channel 141, 143 (steps650, 850). The software agents deployed on the two network device 151,153 then begin sending their respective large response data DATA1, DATA3back to the switch 100 (steps 660, 860). The software agents may breakthe large response data into blocks smaller than or equal to, in size,the second portion of memory 161, 163 allocated to the correspondingreceive socket buffers 121, 123.

As each block is successfully delivered to the switch 100, furthergo-ahead signals OK1, OK3 are sent by the switch 100 back to the networkdevices 151, 153 (steps 650, 850). The steps of sending a block of dataDATA1, DATA3 (steps 660, 860), receiving the block and signaling thesoftware agent on the network device 151, 153 with the go-ahead signalOK1, OK3 (steps 650, 850) may be repeated for each corresponding networkdevice 151, 153 until the entire message (from each device) has beensuccessfully transferred.

In one example, the size of the individual, pre-designated firstportions of memory 130 are the same as each other. In a further example,the size of the individual, pre-designated second portions of memory 160are the same as each other. In another example, the size of the firstand second portions of memory are predetermined, and fixed. A “memorypool” is a term used to describe a pool of fixed-size blocks of memory(often all of the same size). Due to the significantly reduced overheadthis method can substantially improve performance for objects that needfrequent allocation and de-allocation. Therefore, in an example whereembodiments draw secondary portions of memory from a “pool”, they willbe the same size and predetermined (pre-designated as buffer memoryportions), so as to further reduce the overheads.

Preferably, in the event that there are not adequate second portions ofmemory 160 available to allocate a second portion of memory to one ormore of the corresponding receive socket buffers 121, 123 in order toreceive the large response data, then the processor 110 will not sendthe go-ahead signals OK1, OK3 for the respective communication channel141, 143 until a sufficient amount of memory resources have becomeavailable. In the absence of a go-ahead signal OK1, OK3, the softwareagent on each corresponding network device 151, 153 will not begin thetransfer of the large response data DATA1, DATA 3. Only once a go-aheadsignal OK1, OK3 for a given communication channel 141, 143 is receivedby the software agent on the corresponding network device 151, 153(steps 650, 850) will the large response data transfer DATA1, DATA3begin for the corresponding communication channel 141, 143 (steps 660,860).

Preferably, and in accordance to the present example, once each of thelarge data transfers is successfully completed for the two communicationchannels 141, 143, the switch 100 sends a large data complete signalBF1, BF3 back to the software agent on each network device 151, 153(steps 670, 870). In a further example, the corresponding secondportions of memory 161, 163 are then returned to the pool of availablesecond portions of memory 160 accordingly (steps 680, 880).

The allocation, and de-allocation, of second portions of memory 160 toany of the receive socket buffers 121-125 is handled by the processor110 in the switch 100. Preferably, any memory portion may be allocatedand de-allocated asynchronously to any other memory, i.e. the processor110 may manage allocation of second portions of memory 160 to eachreceive socket buffer 121-125 independently of each other as necessary.

It will be recognized by the person skilled in the art that whilst theabove example has been described in relation to two network devices 151,153 delivering large response data DATA1, DATA3 to the switch 100, thepresent method can be easily expanded to handle large data responsesfrom more than two network devices connected to the switch 100.

A Method of Dynamic Buffer Allocation

FIG. 9 shows method steps of dynamic buffer allocation as outlinedabove. In a first step 910, a first communication channel is establishedbetween a switch and one of at least two network devices. In a secondstep 920, a first receive buffer is configured, at the switch, for thefirst established channel. In a third step 930, a first portion ofmemory is allocated to the first receive buffer. In a fourth step 940, afirst signal from the one of said at least two network devices isreceived by the switch over the first communications channel establishedbetween the switch and said one of said at least two network devices. Ina fifth step 950, upon receipt of the first signal, a second portion ofmemory is allocated to the first receive buffer. The size of the secondportion of memory may be selected based on the content of the firstsignal.

Non-Transient Machine-Readable Storage Medium

Although at least some aspects of the examples described herein withreference to the drawings comprise computer processes performed in aprocessor 110, the examples also extend to computer programs,particularly computer programs on or in a carrier, adapted for puttingthe disclosed method and apparatus into practice. The program may be inthe form of non-transitory source code, object code, a code intermediatesource and object code such as in partially compiled form, or in anyother non-transitory form suitable for use in the implementation ofprocesses according to the examples described. The carrier may be anyentity or device capable of carrying the program. For example, thecarrier may comprise a storage medium, such as a solid-state drive (SSD)or other semiconductor-based RAM; a ROM, for example a CD ROM or asemiconductor ROM; a magnetic recording medium, for example a floppydisk or hard disk; optical memory devices in general; etc.

As seen in FIG. 10, the method of dynamic buffer allocation may beimplemented by a processor 110 executing instructions stored on anon-transient and machine-readable storage medium. In a first step 1010,the processor 110 establishes a first communication channel between aswitch and one of at least two network devices. In a second step 1020,the processor 110 configures a first receive buffer for the firstestablished channel at the switch. In a third step 1030, the processorallocates a first portion of memory to the first receive buffer. In afourth step 1040, the processor 110 receives a first signal from the oneof said at least two network devices over the first communicationschannel established between the switch and said one of said at least twonetwork devices. In a fifth step 1050, the processor 110 allocates asecond portion of memory to the first receive buffer.

It will also be understood that the processor 110 referred to herein mayin practice be provided by a single chip or integrated circuit or pluralchips or integrated circuits, optionally provided as a chipset, anapplication-specific integrated circuit (ASIC), field-programmable gatearray (FPGA), digital signal processor (DSP), etc. The chip or chips maycomprise circuitry (as well as possibly firmware) for embodying at leastone or more of a data processor or processors, a digital signalprocessor or processors, baseband circuitry and radio frequencycircuitry, which are configurable so as to operate in accordance withthe exemplary embodiments. In this regard, the examples provided may beimplemented at least in part by computer software stored in(non-transitory) memory and executable by the processor, or by hardware,or by a combination of tangibly stored software and hardware (andtangibly stored firmware).

Message Formats

The “Big Ready” signal sent from any network device 151-155 to theswitch 100 indicates that the network device 151-155 is ready to sendlarge response data (i.e. larger in size than the first portion ofmemory 131-135 allocated to the corresponding receive socket buffer121-125 at the switch) to the switch 100. In one example, the “BigReady” signal may be formatted as follows:

BigUpload{“Seq”:n,“Size”:nnnnnn}

The two parameters indicate the sequence number and the total size ofthe large response message accordingly. The switch 100 receives the “BigReady” signal and attempts to allocate a second portion of memory to thecorresponding receive socket buffer 121-125 as necessary.

When the switch 100 is ready to receive large response data, the switch100 replies with a go-ahead signal to the software agent on the networkdevice 151-155. The go-ahead signal identifies the relevant portion ofthe response data that can be accommodated by the increased receivesocket buffer 121-125 at the switch 100, and may be formatted as:

BigReady{“Seq”:n, “From”:nnnnnn,“To”:nnnnnn}

The three parameters indicate the sequence number of the data to bereceived by the switch 100, the start point in the data to be received,and end point in the data to be received.

Once the software agent has received the go-ahead signal, the softwareagent may then send part of the large response data to the switch 100.The large response data may be formatted as:

BigData {“Seq”:n,“From”:nnn,“To”:nnn}

The three parameters indicate the sequence number of the data to be sentby the software agent, the start point in the data to be sent, and theend point in the data to be sent to the switch 100.

As an example, when each network device 151-155 is ready to send largeresponse data across the network to the switch 100, the software agenton each network device 151-155 sends the “Big Ready” signal to theswitch 100, e.g.:

BigUpload{“Seq”:1,“Size”:20}

In this example, the first sequence has a size of “20”. The switch 100has allocated a second portion of memory 161-165 with size “5” to thecorresponding receive socket buffer 121-125, and so responds with themessage:

BigReady{“Seq”:1,“From”:1,“To”:5}

This go-ahead message requests the first five blocks of the sequence.The software agent begins sending back the large response data in thefollowing format:

BigData{“Seq”:1,“From”:1,“To”:5}

When the switch 100 is ready to receive next block of large responsedata, the switch 100 replies with a further go-ahead signal to thesoftware agent on the network device 151-155, e.g.:

BigReady{“Seq”:2,“From”:6,“To”:10}

This subsequent go-ahead message requests the second five blocks of thesequence. The software agent begins sending back the large response datain the following format:

BigData{“Seq”:2,“From”:6,“To”:10}

This exchange between the switch 100 and the software agent continues inthis manner until the large response transfer (of fragmented datablocks) has been successfully completed.

The above examples are to be understood as illustrative examples ofembodiments of the present disclosure. Further examples are envisaged.For example, whilst the above examples have been described in terms offeatures found in a network employing the TCP/IP protocols, the presentdisclosure is not limited to such, and other networking and transferprotocols may implement the principles of the present disclosure.

In some examples, the initial socket allocation to each network devicedoes not occur at the same time (given that the network devices mayconnect to the network at different times).

It is to be understood that any feature described in relation to any oneexample may be used alone, or in combination with other featuresdescribed, and may also be used in combination with one or more featuresof any other of the examples, or any combination of any other of theexamples. Furthermore, equivalents and modifications not described abovemay also be employed without departing from the scope of the presentdisclosure, which is defined in the accompanying claims.

1. A switch for a network, the switch comprising a processor and memory,whereby the processor is configured to: establish a first communicationchannel between the switch and one of at least two network devices;configure, at the switch, a first receive buffer for the firstestablished channel; allocate a first portion of memory to the firstreceive buffer, and in response to receiving a first signal from the oneof said at least two network devices over the first communicationchannel established between the switch and said one of said at least twonetwork devices, allocate a second portion of memory to the firstreceive buffer, wherein: the first signal indicates an amount of data tobe transferred from the network device to the switch is greater than afirst predetermined amount; and the second portion of memory is greaterthan the first portion of memory.
 2. The switch according to claim 1,wherein the processor is further configured to: send a first signal tothe one of at least two network devices over the first communicationchannel established between the one of said at least two network devicesand the switch, confirming allocation of the second portion of memory tothe first receive buffer.
 3. The switch according to claim 2, whereinthe processor is further configured to: delay sending the first signaluntil sufficient second portions of memory are available to allocate thesecond portion of memory to the first receive buffer.
 4. The switchaccording to claim 2, wherein the processor is further configured to:send a second signal to the one of at least two network devices over thefirst communication channel established between one of said at least twonetwork devices and the switch; and de-allocate the second portion ofmemory from the first receive buffer.
 5. (canceled)
 6. The switchaccording to claim 1, wherein the size of the first memory portion andsecond memory portion are predetermined.
 7. The switch according toclaim 6, wherein the first portion of memory is 4 kilobytes and thesecond portion of memory is 128 kilobytes.
 8. The switch according toclaim 1, wherein the processor is further configured to: receive datafrom the one of said at least two network devices over the firstcommunication channel established between the switch and said one ofsaid at least two network devices, wherein the received data maycomprise an amount of data that is smaller in size than the firstportion of memory, interposed with an amount of data that is larger insize than the first portion of memory.
 9. The switch according to claim1, whereby the processor is further configured to: automaticallyallocate said first portion of memory to the first receive buffer whenthe first communication channel is established.
 10. The switch accordingto claim 1, whereby the processor is further configured to: dynamicallyallocate the second portion of memory to the first receive buffer fromavailable second portions of memory that can be allocated to one ofeither of the least two network devices.
 11. The switch according toclaim 1, whereby the processor is further configured to: establish asecond communication channel between the switch and another of said atleast two network devices; configure, at the switch, a second receivebuffer for the second established channel; allocate a first portion ofmemory to the second receive buffer; and in response to receiving asignal from the another one of said at least two network devices overthe second communication channel established between the switch and saidanother one of said at least two network devices, allocate a secondportion of memory to the second receive buffer.
 12. The switch accordingto claim 11, wherein the processor is further configured to: allocateand/or de-allocate any of the first or second portions of memory to thefirst receive buffer, and the first or second portions of memory to thesecond receive buffer, asynchronously of one another.
 13. A networkdevice comprising a software agent, the agent being configured to:establish a communication channel between the network device and aswitch; and send a signal to the switch if an amount of data to betransferred from the network device to the switch over the establishedcommunication channel is greater than a first predetermined amount. 14.The network device according to claim 13, wherein the agent is furtherconfigured to: delay transferring data larger in size than the firstpredetermined amount until the agent receives a signal from the switchconfirming the switch is configured to receive data larger in size thanthe first predetermined amount.
 15. The network device of claim 14,wherein the agent is further configured to: fragment the data that islarger than the first predetermined amount into blocks, equal in size toa second predetermined amount, to be transferred to the switch over theestablished communication channel.
 16. The network device according toclaim 13, wherein the agent is further configured to: interposetransmission of an amount of data that is smaller in size than the firstpredetermined amount with an amount of data that is larger in size thanthe first predetermined amount.
 17. A method of dynamically allocatingmemory to a receive buffer, the method comprising: establishing a firstcommunication channel between a switch and one of at least two networkdevices; configuring, at the switch, a first receive buffer for thefirst established channel; allocating a first portion of memory to thefirst receive buffer; receiving a first signal from the one of said atleast two network devices over the first communication channelestablished between the switch and said one of said at least two networkdevices; and allocating a second portion of memory to the first receivebuffer, wherein: the first signal indicates an amount of data to betransferred from the network device to the switch is greater than afirst predetermined amount; and the second portion of memory is greaterthan the first portion of memory.
 18. A non-transitory computer-readablestorage medium comprising a set of computer-readable instructions storedthereon, which, when executed by a processor, cause the processor to:establish a first communication channel between a switch and one of atleast two network devices; configure, at the switch, a first receivebuffer for the first established channel; allocate a first portion ofmemory to the first receive buffer; receive a first signal from the oneof said at least two network devices over the first communicationchannel established between the switch and said one of said at least twonetwork devices; and allocate a second portion of memory to the firstreceive buffer, wherein: the first signal indicates an amount of data tobe transferred from the network device to the switch is greater than afirst predetermined amount; and the second portion of memory is greaterthan the first portion of memory.